pp108 : Migrating Web Applications to Use Libraries

Migrating Web Applications to Use Libraries

This topic presents an overview of migration of Web applications to use Libraries.

To overcome the limitations of HTML Components (HTCs), and to improve the performance of the application, the Web components have been ported to JScript. The new components are now available as part of the JScript library.

Although Libraries contain all the components that were handled earlier using HTCs, there are some changes you must make in the API of some components.

Guidelines for Migration

The following are some of the keywords that need to be modified when migrating applications from Behaviors to Libraries:

  • Replace <link rel='stylesheet' type='text/css' href='/cordys/wcp/style/behaviors.css'/> with <script src='/cordys/wcp/application.js'></script>.
  • Replace window.event with window.application.event for all Process Platform Web components events, but not for the traditional HTML components. For example, window.event.data would change to window.application.event.data, but window.event.srcElement would remain the same, since it is a DHTML event.
  • Replace dhtmlObject.addBehavior(behaviorurl) with application.addType(<object>, <fullyQualifiedName>).
  • Replace dhtmlObject.removeBehavior(behaviorurl) with application.removeLibrary(libraryurl,dhtmlObject).
  • Replace dhtmlObject.className = 'Stylerulename' with application.addType(<object>, <fullyQualifiedName>).
  • Replace window.attachEvent('eventname',functionpointer) with application.addListener('eventname',function pointer).
  • Replace window.detachEvent('eventname',fp); with application.removeListener('eventname',function pointer).

Due to a parsing problem in all versions of Microsoft Internet Explorer, all the library declarations must be done before the XML Dataisland declarations.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script src="/cordys/wcp/application.js"></script> <script Type="cordys/xml" id="requestXML"> <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" url="com.eibus.web.soap.Gateway.wcp? organization=o=system,cn=cordys,o=vanenburg.com"> <SOAP:Body> <GetXMLObject xmlns="http://schemas.cordys.com/1.0/xmlstore"> <key>Cordys/WCP/Menu/Cordys/WCP/systemAdmin</key> </GetXMLObject> </SOAP:Body> </SOAP:Envelope> </script> </head> <body> <div cordysType="wcp.library.data.BusDataIsland></div> <div cordysType="wcp.library.util.Preferences></div> </body> </html>